package com.xiaomai.server;

import java.util.List;

import MyUtil.MyUitl;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.ValueStack;
import com.sun.java_cup.internal.runtime.virtual_parse_stack;
import com.xiaomai.Dao.Editing;
import com.xiaomai.Dao.The_secondary;
import com.xiaomai.Dao.UserEntityDao;
import com.xiaomai.Dao.Userdao;
import com.xiaomai.entity.Category;
import com.xiaomai.entity.Classification;
import com.xiaomai.entity.Packaging;
import com.xiaomai.entity.UserEntity;

public class MyUser_server implements User_server{

	public List<Category> categoryAll() {
		// TODO Auto-generated method stub
		Userdao u=(Userdao) MyUitl.getMapper(Userdao.class);
		List<Category> categoryAll = u.CategoryAll();
		return categoryAll;
	}

	public List<Classification> books() {
		// TODO Auto-generated method stub
		Editing u=(Editing) MyUitl.getMapper(Editing.class);
		List<Classification> f = u.classification();
		return f;
	}

	public List<Classification> books1() {
		// TODO Auto-generated method stub
		Editing u=(Editing) MyUitl.getMapper(Editing.class);
		List<Classification> f1 = u.fication();
		return f1;
	}

	public List<Classification> The_Latest() {
		// TODO Auto-generated method stub
		Editing u=(Editing) MyUitl.getMapper(Editing.class);
		List<Classification> f1 = u.The_latest();
		return f1;
	}

	public List<Classification> Selling() {
		// TODO Auto-generated method stub
		Editing u=(Editing) MyUitl.getMapper(Editing.class);
		List<Classification> f1 = u.Selling();
		return f1;
	}

	
	public List<Category> Two(String id) {
		// TODO Auto-generated method stub
		The_secondary t=(The_secondary) MyUitl.getMapper(The_secondary.class);
		List<Category> twe = t.Twe(id);
		return twe;
	}

	public Classification Three(String id) {
		// TODO Auto-generated method stub
		The_secondary t=(The_secondary) MyUitl.getMapper(The_secondary.class);
		 Classification three = t.Three(id);
		 return three;
	}

	public List<Classification> GetBookListByCateId(String CateId) {
		// TODO Auto-generated method stub
		The_secondary t=(The_secondary) MyUitl.getMapper(The_secondary.class);
		List<Classification> three = t.GetBookListByCateId(CateId);
		 return three;
	}

	public Category Two_categories(String id) {
		// TODO Auto-generated method stub
		The_secondary t=(The_secondary) MyUitl.getMapper(The_secondary.class);
		Category Two_cat = t.Two_categories(id);
		
		return Two_cat;
	}
	
	public List<Category> getCategoriesList(String CateId){
		The_secondary t=(The_secondary) MyUitl.getMapper(The_secondary.class);
		List<Category> Two_cat = t.getCategoriesList(CateId);
		
		return Two_cat;
	}

	public Classification yiji(String id) {
		// TODO Auto-generated method stub
		The_secondary t=(The_secondary) MyUitl.getMapper(The_secondary.class);
		List<Classification> categoriesLis = t.getCategoriesLis(id);		
		return null;	
	}

	public Packaging erji(String f_id, String c_id) {
		// TODO Auto-generated method stub
		The_secondary t=(The_secondary) MyUitl.getMapper(The_secondary.class);
		Packaging p=new Packaging();
		Category two_categories = t.Two_categories(f_id);
		p.setCategory(two_categories);
		if(c_id==null){
			ValueStack valueStack = ActionContext.getContext().getValueStack();
			List<Classification> categoriesLis = t.getCategoriesLis(f_id);
			p.setBocks(categoriesLis);
			Category category = p.getCategory();
			valueStack.set("Category", category);
			return p;
		}
		else{//getCategoriesLis 	getCategoriesListId  Two_categorie
			ValueStack valueStack = ActionContext.getContext().getValueStack();
			Category two_categorie = t.Two_categorie(c_id);
			List<Classification> categoriesListId = t.getCategoriesListId(c_id);
			p.setSecondcategory(two_categorie);
			p.setBocks(categoriesListId);
			Category category = p.getCategory();
			valueStack.set("Category", category);
			System.out.println(p.getSecondcategory());
			return p;
		}
	}

}
